home *** CD-ROM | disk | FTP | other *** search
- #import <stdio.h>
- #import <libc.h>
- #import <ctype.h>
- #import <strings.h>
- #define SNDPLAY "/usr/bin/sndplay "
- void voice( char *message, char *wordSouce);
- void number( char *buf, char *systemBuf);
-
-
- void
- main()
- {
- char string[300];
-
- gets(string);
- voice( string, "/user/jiro/Library/Sounds");
- return;
- }
-
-
- void
- voice( char *message, char *wordSource)
- {
- char *index;
- char buf[128], *bufIndex;
- char buf2[1000];
- char systemBuf[1000];
-
- if( *message == '\0') // if we got a null string;
- return; // return
-
- index = message;
- bufIndex = buf;
-
- for( index = message; *(index-1) != '\0'; index ++)
- {
- *bufIndex = *index;
- if( isupper(*bufIndex))
- *bufIndex = tolower(*bufIndex);
-
- if( *index == ' ' || *index == '\0')
- {
- *bufIndex = '\0';
-
- if( isdigit( *buf))
- number( buf, systemBuf);
- else
- {
- fprintf(stderr,"Buf is <%s>.\n", buf);
- sprintf(buf2, " %s.snd",buf);
- strcat(systemBuf, buf2);
- }
- fprintf(stderr,"Parsing: -> %s\n", systemBuf);
- bufIndex = buf;
- continue;
- }
- bufIndex ++;
- }
-
- chdir( wordSource);
- sprintf(buf2, "%s %s", SNDPLAY, systemBuf);
- fprintf(stderr,"Playing: -> %s\n", buf2);
- system(buf2);
- return;
- }
-
-
- void
- number(char *buf, char *systemBuf)
- {
- int number, temp;
- char *digits[16] = { " zero.snd", " one.snd"," two.snd", " three.snd",
- " four.snd", " five.snd", " six.snd", " seven.snd",
- " eight.snd", " nine.snd", " ten.snd",
- " eleven.snd", " twelve.snd",
- " thirteen.snd", " fourteen.snd",
- " fifteen.snd"};
-
-
- number = atoi(buf);
-
- if( number > 0 && number < 20)
- strcat(systemBuf, digits[number]);
-
- return;
- }
-
-
-
-
-